<?php

/**
 * Publication filter form base class.
 *
 * @package    PubliGest
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePublicationFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'contact'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contactPhone'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'web'             => new sfWidgetFormFilterInput(),
      'email'           => new sfWidgetFormFilterInput(),
      'address'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'country'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'state'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'locality'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'gmapsLat'        => new sfWidgetFormFilterInput(),
      'gmapsLng'        => new sfWidgetFormFilterInput(),
      'image1'          => new sfWidgetFormFilterInput(),
      'image2'          => new sfWidgetFormFilterInput(),
      'image3'          => new sfWidgetFormFilterInput(),
      'image4'          => new sfWidgetFormFilterInput(),
      'image5'          => new sfWidgetFormFilterInput(),
      'image6'          => new sfWidgetFormFilterInput(),
      'rooms'           => new sfWidgetFormFilterInput(),
      'breakfast'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'bedLinen'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'cleaningService' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'tv'              => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'airConditioning' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'whirlpool'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'fullKitchen'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'garage'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'pool'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'grill'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'extras'          => new sfWidgetFormFilterInput(),
      'product_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Product'), 'add_empty' => true)),
      'order_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Order'), 'add_empty' => true)),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'contact'         => new sfValidatorPass(array('required' => false)),
      'contactPhone'    => new sfValidatorPass(array('required' => false)),
      'web'             => new sfValidatorPass(array('required' => false)),
      'email'           => new sfValidatorPass(array('required' => false)),
      'address'         => new sfValidatorPass(array('required' => false)),
      'country'         => new sfValidatorPass(array('required' => false)),
      'state'           => new sfValidatorPass(array('required' => false)),
      'locality'        => new sfValidatorPass(array('required' => false)),
      'gmapsLat'        => new sfValidatorPass(array('required' => false)),
      'gmapsLng'        => new sfValidatorPass(array('required' => false)),
      'image1'          => new sfValidatorPass(array('required' => false)),
      'image2'          => new sfValidatorPass(array('required' => false)),
      'image3'          => new sfValidatorPass(array('required' => false)),
      'image4'          => new sfValidatorPass(array('required' => false)),
      'image5'          => new sfValidatorPass(array('required' => false)),
      'image6'          => new sfValidatorPass(array('required' => false)),
      'rooms'           => new sfValidatorPass(array('required' => false)),
      'breakfast'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'bedLinen'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'cleaningService' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'tv'              => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'airConditioning' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'whirlpool'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'fullKitchen'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'garage'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'pool'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'grill'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'extras'          => new sfValidatorPass(array('required' => false)),
      'product_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Product'), 'column' => 'id')),
      'order_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Order'), 'column' => 'id')),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('publication_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Publication';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'contact'         => 'Text',
      'contactPhone'    => 'Text',
      'web'             => 'Text',
      'email'           => 'Text',
      'address'         => 'Text',
      'country'         => 'Text',
      'state'           => 'Text',
      'locality'        => 'Text',
      'gmapsLat'        => 'Text',
      'gmapsLng'        => 'Text',
      'image1'          => 'Text',
      'image2'          => 'Text',
      'image3'          => 'Text',
      'image4'          => 'Text',
      'image5'          => 'Text',
      'image6'          => 'Text',
      'rooms'           => 'Text',
      'breakfast'       => 'Boolean',
      'bedLinen'        => 'Boolean',
      'cleaningService' => 'Boolean',
      'tv'              => 'Boolean',
      'airConditioning' => 'Boolean',
      'whirlpool'       => 'Boolean',
      'fullKitchen'     => 'Boolean',
      'garage'          => 'Boolean',
      'pool'            => 'Boolean',
      'grill'           => 'Boolean',
      'extras'          => 'Text',
      'product_id'      => 'ForeignKey',
      'order_id'        => 'ForeignKey',
      'created_at'      => 'Date',
      'updated_at'      => 'Date',
    );
  }
}
